home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / tgrind.zip / TGRIND.SH < prev    next >
Linux/UNIX/POSIX Shell Script  |  1990-05-23  |  2KB  |  101 lines

  1. #! /bin/csh
  2. # Script to grind nice program listings using TeX.
  3. #
  4. # written Feb, 1985 by Van Jacobson, Lawrence Berkeley Laboratory (adapted
  5. # from the 4.2bsd "vgrind" script).
  6. #
  7. # Since TeX output handling is site dependent, you'll have to edit this
  8. # file to get output to your local typesetting device(s).  Our site uses
  9. # the flags "-v" (versatec output), "-q" (qms output) and "-k" (keep dvi file)
  10. # to route output.  Put something appropriate to your site at the "PUT OUTPUT
  11. # HANDLING..." comment at the end of this script.  If you've already dealt
  12. # with this in your local tex command, just change the -v/q/k (or whatever)
  13. # cases in the first "switch" to set variable "texoptions" appropriately.
  14. #
  15. set b=/usr/local/lib/tfontedpr
  16. set tex=/usr/local/tex
  17. set options=
  18. set texoptions=
  19. set files=
  20. set head=""
  21. set format=""
  22. set output="ver"
  23. top:
  24. if ($#argv > 0) then
  25.     switch ($1:q)
  26.  
  27.     case -d:
  28.     if ($#argv < 2) then
  29.         echo "tgrind: $1:q option must have argument"
  30.         goto done
  31.     else
  32.         set options = ($options $1:q $2)
  33.         shift
  34.         shift
  35.         goto top
  36.     endif
  37.             
  38.     case -f:
  39.     set format="Y"
  40.     shift
  41.     goto top
  42.  
  43.     case -h:
  44.     if ($#argv < 2) then
  45.         echo "tgrind: $1:q option must have argument"
  46.         goto done
  47.     else
  48.         set head="$2"
  49.         shift
  50.         shift
  51.         goto top
  52.     endif
  53.             
  54.     case -v:
  55.     set output="ver"
  56.     shift
  57.     goto top
  58.  
  59.     case -q:
  60.     set output="qms"
  61.     shift
  62.     goto top
  63.  
  64.     case -k:
  65.     set output=""
  66.     shift
  67.     goto top
  68.  
  69.     case -*:
  70.     set options = "$options $1:q"
  71.     shift
  72.     goto top
  73.  
  74.     default:
  75.     set files = "$files $1:q"
  76.     shift
  77.     goto top
  78.     endsw
  79. endif
  80.  
  81. if ("$format" == "Y") then
  82.     if ("$head" != "") then
  83.     $b $options -h "$head" $files
  84.     else
  85.     $b $options $files
  86.     endif
  87.     goto done
  88. endif
  89.  
  90. if ("$head" != "") then
  91.     $b $options -h "$head" $files >/tmp/$$.tex
  92. else
  93.     $b $options $files >/tmp/$$.tex
  94. endif
  95. cd /tmp
  96. $tex $texoptions $$.tex
  97.  
  98. # PUT OUTPUT HANDLING COMMANDS HERE.
  99.  
  100. done:
  101.